/*
 * Copyright 2006-2007 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.code.sant

import scala.util.DynamicVariable

/**
 * @author Stepan Koltsov
 */
object Ant {
  // later it will be DynamicVariable
  val projectVar = new DynamicVariable[SantProject](null)
  def project = projectVar.value
  def projectOption = project match {
    case null => None
    case x => Some(x)
  }
  
  def antProject = project.antProject
  
  // tasks
  
  def task(name: String) = project.task(name)
  
  def chmod = task("chmod")
    
  def javac = task("javac")
  
  def mkdir = task("mkdir")
  def delete = task("delete")
  def copy = task("copy")
  
  def echo = task("echo")
  
  def get = task("get")
  
  def jar = task("jar")
  def zip = task("zip")
  def tar = task("tar")
  def gzip = task("gzip")
  
  def untar = task("untar")
  def unjar = task("unjar")
  def unzip = task("unzip")
  def gunzip = task("gunzip")
  
  def scalac = task("scalac")
  
  def taskdef = task("taskdef")
  
  // see com.google.code.sant.ant.SantTask
  def sant = task("sant")
  
  // types

  def dataType(name: String) = project.dataType(name)
  
  def fileset: AntType = dataType("fileset")
  
  def path = dataType("path")

}
